<template>
  <div>
    <div style="display: flex; line-height: 60px">
      <div style="margin-top: 10px">
        <i :class="icon" style="font-size: 40px;cursor:pointer"
           @click="collapse">
        </i>
      </div>
      <div style="flex: 1;text-align: center;margin-top: 8px;font-size: 24px">
        <span>物流跟踪系统</span>
      </div>

      <el-dropdown style="margin-left: 15px;margin-top: 5px">
        <el-button type="primary">
          菜单<i class="el-icon-arrow-down el-icon--right" style="margin-left: 15px"></i>
        </el-button>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item @click.native="toIndex">系统首页</el-dropdown-item>
          <el-dropdown-item @click.native="toUser">个人中心</el-dropdown-item>
          <el-dropdown-item @click.native="logout">退出登录</el-dropdown-item>
          <el-dropdown-item @click.native="delUser">注销用户</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>
</template>

<script>



export default {
  name: 'HeaderForm',
  data() {
    return {};
  },
  props:{
    icon:String,
  },
  methods: {
    collapse(){
      this.$emit("doCollapse")
    },
    toUser(){
      this.$router.push("/Setting");
    },
    toIndex(){
      this.$router.push("/Home");
    },
    logout(){

      this.$confirm('您确定要退出登录吗?', '提示', {
        confirmButtonText: '确定',
        type: 'warning',
        center: true,

      })
          .then(() => {
            this.$message({
              type:'success',
              message:'退出登录成功'
            })

            this.$router.push("/Login")
            sessionStorage.clear()
          })
          .catch(() => {
            this.$message({
              type:'info',
              message:'已取消退出登录'
            })
          })
    },

    },
}
</script>

<style>

</style>
